package com.ruoyi.project.survey.controller;


import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.survey.domain.param.QuestionDetailQuery;
import com.ruoyi.project.survey.domain.param.UserQuestionAdd;
import com.ruoyi.project.survey.domain.param.UserQuestionQuery;
import com.ruoyi.project.survey.service.UserQuestionService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/userquestion/")
@Api(tags = "做问卷")
@RequiredArgsConstructor
public class UserQuestionController extends BaseController {
    private final UserQuestionService service;


    @PostMapping("save")
    public AjaxResult save(@RequestBody UserQuestionAdd add) {
        return service.save(add);
    }

    @GetMapping("page")
    public TableDataInfo queryPage(UserQuestionQuery query) {
        startPage();
        return getDataTable(service.queryPage(query));
    }

    @GetMapping("detail")
    public TableDataInfo queryDetail(QuestionDetailQuery query) {

        startPage();
        return getDataTable(service.queryDetail(query));
    }

}
